import java.util.ArrayList;
import java.util.List;

/**
 * Created by cc
 * Description: 练习题三
 * User: CZH
 * Date: 2022-09-27
 * Time: 14:37
 */
public class Test03 {

    public static void func1(String str1,String str2){
        char[] chars1 = str1.toCharArray();
        char[] chars2 = str2.toCharArray();
        List<Character> list = new ArrayList<>();
        for (int i = 0; i < chars1.length; i++) {
            boolean isFlag = true;
            for (int j = 0; j < chars2.length; j++) {
                if (chars1[i] == chars2[j]){
                    isFlag = false;
                    break;
                }
            }
            if (isFlag == true) {
                list.add(chars1[i]);
            }
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i));
        }
    }

    public static void func2(String str1,String str2) {
        if (str1 == null || str2 == null) return;
        List<Character> ret = new ArrayList<>();
        for (int i = 0; i < str1.length(); i++) {
            char ch = str1.charAt(i);
            if (!str2.contains(ch+"")) {
                ret.add(ch);
            }
        }
        for (Character character : ret) {
            System.out.print(character);
        }
    }

    public static void main(String[] args) {
        String str1 = "welcome to bit";
        String str2 = "come";
        func2(str1,str2);
    }
}
